from flask import Flask
from .extensions import db, api, session, cors
from .apps.opcua_point_app import opcua_app
from .config import Config


def create_app():
    app = Flask(__name__)
    app.config.from_object(Config())

    # 初始化扩展

    db.init_app(app)
    api.init_app(app)
    session.init_app(app)

    # 注册蓝图
    app.register_blueprint(opcua_app, url_prefix='/opcua')
    cors.init_app(app)
    return app

